import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '合同Id',
    align: 'center',
    dataIndex: 'templateid',
    width: 250,
  },
  {
    title: '合同名字',
    align: 'center',
    dataIndex: 'templatename',
    width: 200,
    customRender: ({ text }) => {
      return text ? text.replace(/\n/g, '<br/>') : '';
    },
  },
  {
    title: '描述',
    align: 'center',
    dataIndex: 'description',
    width: 350,
  }
  
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '合同名字',
    field: 'templatename',
    component: 'JInput',
    colProps: { span: 7 },
  },
  {
    label: '合同Id',
    field: 'templateid',
    component: 'JInput',
    colProps: { span: 9 },
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '合同Id',
    field: 'templateid',
    component: 'Input',
    dynamicRules: () => {
      return [{ required: true, message: '请输入合同Id!' }];
    },
  },
  {
    label: '合同名字',
    field: 'templatename',
    component: 'Input',
    dynamicRules: () => {
      return [{ required: true, message: '请输入合同名字!' }];
    },
  },
  {
    label: '描述',
    field: 'description',
    component: 'InputTextArea',
    componentProps: {
      rows: 3,
    },
  },
  
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  templateid: { title: '合同Id', order: 0, view: 'text', type: 'string' },
  templatename: { title: '合同名字', order: 1, view: 'text', type: 'string' },
  description: { title: '描述', order: 2, view: 'text', type: 'string' },
};
